package com.lanou.list;

/**
 * @author zyj
 * @date 2022年05月18日 14:46
 */
public abstract class AbstractList<E> implements List<E>{
    protected int size;
    @Override
    public int size() {
        return size;
    }

    @Override
    public boolean isEmpty() {
        return size == 0;
    }


    @Override
    public boolean contains(E element) {
        return indexOf(element) != -1;
    }

    @Override
    public void add(E element) {
        add(size(),element);
    }

    protected String outOfBoundsMsg(int index) {
        return "Index: "+index+", Size: "+size;
    }


}
